<?php
 /*****************************************************************************
 * createPDF.php                                                              *
 * Last Modified: 2007-06-06                                                  *
 *                                                                            *
 * createPDF.php is a PHP script using HTML_To_PDF to create a PDF file from  *
 * a HTML file by passing the HTML file's path.                               *
 *                                                                            *
 * BBG_Billing, a PHP application using MySQL for creating and maintaining a  *
 * contacts and invoices database.                                            *
 *                                                                            *
 * @copyright Copyright (C) 2007, Bugs Bee Gone Computer Services             *
 * @owner     Daniel Barnett (Bugs Bee Gone Computer Services)                *
 * @author    Daniel Barnett <dbarnett@bugsbeegone.com>                       *
 * @website   http://www.bugsbeegone.com                                      *
 * @license   http://www.gnu.org/licenses/gpl.html GNU General Public License *
 * @package   BBG_Billing                                                     *
 * @name      createPDF.php                                                   *
 * @version   1.1.0                                                           *
 * @uses      HTML_To_PDF (Written by: Harish Chauhan, 2006-04-19)            *
 *             ->(http://www.phpclasses.org/browse/package/2905.html)         *
 *                                                                            *
 * This file is part of the "BBG_Billing" PHP application.                    *
 *                                                                            *
 * BBG_Billing is free software; you can redistribute it and/or modify        *
 * it under the terms of the GNU General Public License as published by       *
 * the Free Software Foundation; either version 2 of the License, or          *
 * (at your option) any later version.                                        *
 *                                                                            *
 * BBG_Billing is distributed in the hope that it will be useful,             *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU General Public License for more details.                               *
 *                                                                            *
 * You should have received a copy of the GNU General Public License          *
 * along with BBG_Billing; if not, write to the Free Software                 *
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *
 *****************************************************************************/
 
 
  // Require the file html_to_pdf.inc.php, if not found die
  require_once "html_to_pdf.inc.php";

  // Pass filePath and fileName of source document in URL
  $filePath = $_GET['filePath'];
  $fileName = $_GET['fileName'];

  // Create new instance of HTML_TO_PDF()
  $htmltopdf = new HTML_TO_PDF();
	
  //$htmltopdf->useURL(HKC_USE_EASYW);  // default HKC_USE_ABC other HKC_USE_EASYW
  //$htmltopdf->saveFile("{$fileName}.pdf");  // Save file as "fileName".pdf
  $htmltopdf->downloadFile("{$fileName}.pdf");  // Download file as "fileName".pdf
  //$result = $htmltopdf->convertHTML("<b>MY TEST</b>");  // Create new PDF from HTML tags
  $result = $htmltopdf->convertURL("{$filePath}");  // Create new PDF from HTML file
	
  // If there is an error, output the error message
  if($result == false)
      echo $htmltopdf->error();
?>
